package com.nursinghome.common.service.impl;

import com.nursinghome.bean.SysLog;
import com.nursinghome.common.mapper.SysLogMapper;
import com.nursinghome.common.service.SysLogService;
import com.nursinghome.exception.NurisingHomeException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysLogServiceImpl implements SysLogService {
    @Autowired
    private SysLogMapper sysLogMapper;
    @Override
    public List<SysLog> selectByUserName(String username) {
        return sysLogMapper.selectByUsername(username);
    }

    @Override
    public void insert(SysLog sysLog) throws NurisingHomeException {
        if (sysLogMapper.insert(sysLog) != 1) {
            throw new NurisingHomeException("日志生成失败");
        }
    }
}
